import java.util.Scanner;

public class Learn4_23 {
    public static void hanoi (char a, char b, char c, int n) {
        if (n == 1) move (a, c);
        else {
            hanoi (a, c, b, n - 1);
            move (a, c);
            hanoi (b, a, c, n - 1);
        }
    }

    public static int Max (int a, int b) {
        return a > b ? a : b;
    }

    public static void move (char a, char b) {
        System.out.printf ("%c -> %c", a, b);
        System.out.println ();
    }

    public static void main (String[] args) {
        char a = 'A';
        char b = 'B';
        char c = 'C';
        Scanner p = new Scanner (System.in);
        System.out.println ("请输入：");
        int n = p.nextInt ();
        hanoi (a, b, c, n);
    }

    public static int di (int n) {
        if (n == 1) return 1;
        return n * di (n - 1);
    }

    public static void main6 (String[] args) {
        Scanner p = new Scanner (System.in);
        int n = p.nextInt ();
        System.out.println ("阶乘的值是：");
        System.out.println (di (n));

    }

    public static void main5 (String[] args) {
        Scanner p = new Scanner (System.in);
        int a = p.nextInt ();
        int b = p.nextInt ();
        System.out.println ("两个整数的最大值：");
        System.out.println (max (a, b));
        double c = p.nextDouble ();
        double d = p.nextDouble ();
        double e = p.nextDouble ();
        System.out.println ("三个浮点数最大值：");
        System.out.println (max (c, d, e));
    }

    public static double max (double a, double b, double c) {
        if (a > b) b = a;
        if (b > c) return b;
        else return c;
    }


    public static void main4 (String[] args) {
        Scanner p = new Scanner (System.in);
        int a = p.nextInt ();
        int b = p.nextInt ();
        System.out.println ("两个整数的和是：");
        System.out.println (sum (a, b));

        double c = p.nextDouble ();
        double d = p.nextDouble ();
        double e = p.nextDouble ();
        System.out.println ("三个小数的和是：");
        System.out.println (sum (c, d, e));

    }

    public static int sum (int a, int b) {
        return a + b;
    }

    public static double sum (double a, double b, double c) {
        return a + b + c;
    }

    public static void main3 (String[] args) {
        Scanner p = new Scanner (System.in);
        int n = p.nextInt ();
        int i = 1;
        int j = 1;
        int sum = 0;
        for (int t = 0; t < n; t++) {
            sum = i + j;
            i = j;
            j = sum;
        }
        System.out.println ("数列的前n项和是：");
        System.out.println (sum);


    }

    public static void main2 (String[] args) {
        Scanner p = new Scanner (System.in);
        int a = p.nextInt ();
        int s = 1;
        int sum = 0;
        for (int i = 1; i <= a; i++) {
            s = s * i;
            sum = sum + s;
        }
        System.out.println ("阶乘和是：");
        System.out.println (sum);

    }

    public static int max (int a, int b) {
        if (a > b) return a;
        else return b;
    }

    public static void main1 (String[] args) {
        Scanner p = new Scanner (System.in);
        int a = p.nextInt ();
        int b = p.nextInt ();
        int c = p.nextInt ();
        System.out.println ("三个数的最大值是：");
        System.out.println (max (max (a, b), c));
    }
}
